<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RocketMQ 部署与集成指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        .highlight {
            background: linear-gradient(90deg, rgba(236, 72, 153, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
            border-left: 4px solid #8b5cf6;
        }
        pre {
            background-color: #f8f8f8;
            border-radius: 6px;
            padding: 16px;
            overflow-x: auto;
        }
        code {
            font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
            color: #e83e8c;
        }
        .hero {
            background: linear-gradient(135deg, #6b21a8 0%, #9333ea 100%);
        }
        .step-number {
            width: 32px;
            height: 32px;
            background-color: #8b5cf6;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            margin-right: 12px;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4">
        <div class="max-w-6xl mx-auto">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4 leading-tight">RocketMQ 部署与集成指南</h1>
                    <p class="text-xl mb-8 opacity-90">全面掌握分布式消息队列的部署配置与SpringBoot集成方案</p>
                    <div class="flex flex-wrap gap-3">
                        <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full">消息队列</span>
                        <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full">分布式系统</span>
                        <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full">SpringBoot</span>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="w-full max-w-md">
                        <div class="mermaid">
                            graph LR
                            A[Producer] -->|发送消息| B[Broker]
                            B -->|存储消息| C[(存储)]
                            B -->|推送消息| D[Consumer]
                            D -->|消费确认| B
                            E[NameServer] -->|路由信息| A
                            E -->|路由信息| D
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-6xl mx-auto px-4 py-12">
        <!-- 环境搭建与部署 -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2 flex items-center">
                <i class="fas fa-server mr-3 text-purple-600"></i> 1. 环境搭建与部署
            </h2>
            
            <!-- 单机部署 -->
            <div class="mb-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-700 flex items-center">
                    <span class="step-number">1</span> 单机部署步骤与配置说明
                </h3>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                    <!-- 前置条件 -->
                    <div class="card bg-white rounded-lg p-6">
                        <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                            <i class="fas fa-list-check mr-2"></i> 前置条件
                        </h4>
                        <ul class="space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                <span>JDK 1.8+</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                <span>Maven 3.2.x+（如需编译源码）</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                                <span>4GB+ 可用内存</span>
                            </li>
                        </ul>
                    </div>
                    
                    <!-- 下载与解压 -->
                    <div class="card bg-white rounded-lg p-6">
                        <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                            <i class="fas fa-download mr-2"></i> 下载与解压
                        </h4>
                        <pre><code class="language-bash"># 下载二进制发布包
wget https://archive.apache.org/dist/rocketmq/4.9.4/rocketmq-all-4.9.4-bin-release.zip

# 解压
unzip rocketmq-all-4.9.4-bin-release.zip
cd rocketmq-4.9.4</code></pre>
                    </div>
                </div>
                
                <!-- 修改内存配置 -->
                <div class="mt-8">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-memory mr-2"></i> 修改内存配置
                    </h4>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div class="card bg-white rounded-lg p-6">
                            <h5 class="font-medium mb-2">Name Server配置</h5>
                            <pre><code class="language-bash"># 编辑Name Server启动脚本
vi bin/runserver.sh

# 修改以下参数（约在第26行）
JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g"
# 改为
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m"</code></pre>
                        </div>
                        <div class="card bg-white rounded-lg p-6">
                            <h5 class="font-medium mb-2">Broker配置</h5>
                            <pre><code class="language-bash"># 编辑Broker启动脚本
vi bin/runbroker.sh

# 修改以下参数（约在第30行）
JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g"
# 改为
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m"</code></pre>
                        </div>
                    </div>
                </div>
                
                <!-- 启动服务 -->
                <div class="mt-8 card bg-white rounded-lg p-6">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-power-off mr-2"></i> 启动服务
                    </h4>
                    <pre><code class="language-bash"># 启动Name Server
nohup sh bin/mqnamesrv &

# 验证Name Server是否启动成功
tail -f ~/logs/rocketmqlogs/namesrv.log
# 看到"The Name Server boot success..."表示启动成功

# 启动Broker
nohup sh bin/mqbroker -n localhost:9876 &

# 验证Broker是否启动成功
tail -f ~/logs/rocketmqlogs/broker.log
# 看到"The broker[...] boot success..."表示启动成功</code></pre>
                </div>
                
                <!-- 配置文件说明 -->
                <div class="mt-8 card bg-white rounded-lg p-6 highlight">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-cog mr-2"></i> 配置文件说明
                    </h4>
                    <p class="mb-4">Broker的主要配置文件是<code>conf/broker.conf</code>，以下是关键配置项：</p>
                    <pre><code class="language-properties"># Broker集群名称
brokerClusterName=DefaultCluster

# Broker名称
brokerName=broker-a

# Broker ID，0表示Master，大于0表示Slave
brokerId=0

# 删除过期文件的时间点，默认凌晨4点
deleteWhen=04

# 文件保留时间，默认48小时
fileReservedTime=48

# Broker角色，ASYNC_MASTER异步复制，SYNC_MASTER同步双写
brokerRole=ASYNC_MASTER

# 刷盘策略，ASYNC_FLUSH异步刷盘，SYNC_FLUSH同步刷盘
flushDiskType=ASYNC_FLUSH

# Name Server地址，多个用分号分隔
namesrvAddr=localhost:9876</code></pre>
                </div>
            </div>
            
            <!-- 集群部署 -->
            <div class="mt-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-700 flex items-center">
                    <span class="step-number">2</span> 集群部署架构与实施指南
                </h3>
                
                <div class="card bg-white rounded-lg p-6 mb-8">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> 集群架构
                    </h4>
                    <p class="mb-4">一个典型的RocketMQ集群包含以下组件：</p>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <div class="font-medium text-purple-700 mb-2">Name Server集群</div>
                            <p class="text-sm text-gray-600">无状态，相互独立，可横向扩展</p>
                        </div>
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <div class="font-medium text-purple-700 mb-2">Broker集群</div>
                            <p class="text-sm text-gray-600">主从架构，每个Master可以配置多个Slave</p>
                        </div>
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <div class="font-medium text-purple-700 mb-2">生产者/消费者</div>
                            <p class="text-sm text-gray-600">连接到Name Server获取路由信息</p>
                        </div>
                    </div>
                </div>
                
                <!-- 集群模式对比 -->
                <div class="card bg-white rounded-lg p-6 mb-8">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-balance-scale mr-2"></i> 集群模式对比
                    </h4>
                    <div class="overflow-x-auto">
                        <table class="min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">模式</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">优点</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">缺点</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">多Master模式</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">简单，无单点故障，性能最高</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">单个Master宕机期间，该节点上未被消费的消息不可用</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">多Master多Slave模式（异步复制）</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">性能高，消息可靠性较好</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Master宕机时可能丢失少量消息</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">多Master多Slave模式（同步双写）</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">消息不丢失</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">性能相对较低，大约会下降10%左右</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                
                <!-- 集群部署步骤 -->
                <div class="card bg-white rounded-lg p-6">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-code-branch mr-2"></i> 集群部署步骤
                    </h4>
                    <div class="space-y-6">
                        <!-- 步骤1 -->
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <div class="step-number">1</div>
                            </div>
                            <div class="ml-4">
                                <h5 class="text-lg font-medium mb-2">部署多个Name Server</h5>
                                <pre><code class="language-bash"># 在每台Name Server机器上执行
nohup sh bin/mqnamesrv &</code></pre>
                            </div>
                        </div>
                        
                        <!-- 步骤2 -->
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <div class="step-number">2</div>
                            </div>
                            <div class="ml-4">
                                <h5 class="text-lg font-medium mb-2">配置并启动Master Broker</h5>
                                <p class="mb-2">创建<code>conf/2m-2s-async/broker-a.properties</code>：</p>
                                <pre><code class="language-properties">brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
namesrvAddr=nameserver1:9876;nameserver2:9876
listenPort=10911
storePathRootDir=/home/rocketmq/store-a
storePathCommitLog=/home/rocketmq/store-a/commitlog</code></pre>
                                <p class="mt-2">启动Master：</p>
                                <pre><code class="language-bash">nohup sh bin/mqbroker -c conf/2m-2s-async/broker-a.properties &</code></pre>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Docker部署 -->
            <div class="mt-12">
                <h3 class="text-2xl font-semibold mb-6 text-gray-700 flex items-center">
                    <span class="step-number">3</span> Docker容器化部署方案
                </h3>
                
                <div class="card bg-white rounded-lg p-6 mb-8">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fab fa-docker mr-2"></i> 使用官方Docker镜像
                    </h4>
                    
                    <div class="space-y-6">
                        <!-- 步骤1 -->
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <div class="step-number">1</div>
                            </div>
                            <div class="ml-4">
                                <h5 class="text-lg font-medium mb-2">创建自定义网络</h5>
                                <pre><code class="language-bash">docker network create rocketmq_network</code></pre>
                            </div>
                        </div>
                        
                        <!-- 步骤2 -->
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <div class="step-number">2</div>
                            </div>
                            <div class="ml-4">
                                <h5 class="text-lg font-medium mb-2">启动Name Server</h5>
                                <pre><code class="language-bash">docker run -d --name rmqnamesrv --network rocketmq_network \
  -p 9876:9876 \
  -v /path/to/logs:/home/rocketmq/logs \
  -v /path/to/data:/home/rocketmq/data \
  apache/rocketmq:4.9.4 sh mqnamesrv</code></pre>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Docker Compose -->
                <div class="card bg-white rounded-lg p-6 highlight">
                    <h4 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-code mr-2"></i> 使用Docker Compose
                    </h4>
                    <p class="mb-2">创建<code>docker-compose.yml</code>文件：</p>
                    <pre><code class="language-yaml">version: '3'
services:
  namesrv:
    image: apache/rocketmq:4.9.4
    container_name: rmqnamesrv
    ports:
      - 9876:9876
    volumes:
      - ./data/namesrv/logs:/home/rocketmq/logs
    command: sh mqnamesrv
    networks:
      - rocketmq_network

  broker:
    image: apache/rocketmq:4.9.4
    container_name: rmqbroker
    ports:
      - 10911:10911
      - 10909:10909
    volumes:
      - ./data/broker/logs:/home/rocketmq/logs
      - ./data/broker/store:/home/rocketmq/store
      - ./conf/broker.conf:/home/rocketmq/conf/broker.conf
    command: sh mqbroker -c /home/rocketmq/conf/broker.conf
    depends_on:
      - namesrv
    environment:
      - NAMESRV_ADDR=namesrv:9876
    networks:
      - rocketmq_network

  dashboard:
    image: apacherocketmq/rocketmq-dashboard:latest
    container_name: rmqdashboard
    ports:
      - 8080:8080
    depends_on:
      - namesrv
    environment:
      - JAVA_OPTS=-Drocketmq.namesrv.addr=namesrv:9876
    networks:
      - rocketmq_network

networks:
  rocketmq_network:
    driver: bridge</code></pre>
                    <p class="mt-4">启动服务：</p>
                    <pre><code class="language-bash">docker-compose up -d</code></pre>
                </div>
            </div>
        </section>
        
        <!-- 基本命令行操作 -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2 flex items-center">
                <i class="fas fa-terminal mr-3 text-purple-600"></i> 2. 基本命令行操作
            </h2>
            
            <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                <!-- 服务管理 -->
                <div class="card bg-white rounded-lg p-6">
                    <h3 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-cogs mr-2"></i> 服务管理命令
                    </h3>
                    <pre><code class="language-bash"># 启动Name Server
sh bin/mqnamesrv

# 启动Broker
sh bin/mqbroker -n &lt;namesrv_addr&gt; [-c &lt;config_file&gt;]

# 关闭Name Server
sh bin/mqshutdown namesrv

# 关闭Broker
sh bin/mqshutdown broker</code></pre>
                </div>
                
                <!-- 消息管理 -->
                <div class="card bg-white rounded-lg p-6">
                    <h3 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-envelope mr-2"></i> 消息管理命令
                    </h3>
                    <pre><code class="language-bash"># 发送测试消息
sh bin/mqadmin sendMessage -n &lt;namesrv_addr&gt; -t &lt;topic_name&gt; -p "Hello RocketMQ"

# 根据消息ID查询消息
sh bin/mqadmin queryMsgById -n &lt;namesrv_addr&gt; -i &lt;msg_id&gt;

# 根据Key查询消息
sh bin/mqadmin queryMsgByKey -n &lt;namesrv_addr&gt; -t &lt;topic_name&gt; -k &lt;key&gt;</code></pre>
                </div>
                
                <!-- 集群状态 -->
                <div class="card bg-white rounded-lg p-6">
                    <h3 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> 集群状态查询
                    </h3>
                    <pre><code class="language-bash"># 查看集群信息
sh bin/mqadmin clusterList -n &lt;namesrv_addr&gt;

# 查看Broker状态
sh bin/mqadmin brokerStatus -n &lt;namesrv_addr&gt; -b &lt;broker_name&gt;

# 更新Broker配置
sh bin/mqadmin updateBrokerConfig -n &lt;namesrv_addr&gt; -b &lt;broker_name&gt; -k &lt;key&gt; -v &lt;value&gt;</code></pre>
                </div>
            </div>
        </section>
        
        <!-- SpringBoot整合 -->
        <section>
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2 flex items-center">
                <i class="fab fa-java mr-3 text-purple-600"></i> 3. SpringBoot整合RocketMQ
            </h2>
            
            <div class="card bg-white rounded-lg p-6 mb-8">
                <h3 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                    <i class="fas fa-code mr-2"></i> 依赖配置
                </h3>
                <pre><code class="language-xml">&lt;dependencies&gt;
    &lt;!-- SpringBoot基础依赖 --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
    &lt;/dependency&gt;
    
    &lt;!-- RocketMQ Starter --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.apache.rocketmq&lt;/groupId&gt;
        &lt;artifactId&gt;rocketmq-spring-boot-starter&lt;/artifactId&gt;
        &lt;version&gt;2.2.2&lt;/version&gt;
    &lt;/dependency&gt;
    
    &lt;!-- Lombok简化代码 --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
        &lt;artifactId&gt;lombok&lt;/artifactId&gt;
        &lt;optional&gt;true&lt;/optional&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;</code></pre>
            </div>
            
            <!-- 生产者实现 -->
            <div class="card bg-white rounded-lg p-6 mb-8 highlight">
                <h3 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                    <i class="fas fa-paper-plane mr-2"></i> 生产者实现
                </h3>
                <pre><code class="language-java">@Service
@RequiredArgsConstructor
public class OrderMessageProducer {
    
    private final RocketMQTemplate rocketMQTemplate;
    
    // 同步发送
    public SendResult sendSync(OrderMessage message) {
        return rocketMQTemplate.syncSend("test-topic", message);
    }
    
    // 异步发送
    public void sendAsync(OrderMessage message) {
        rocketMQTemplate.asyncSend("test-topic", message, new SendCallback() {
            @Override
            public void onSuccess(SendResult sendResult) {
                log.info("异步发送成功: {}", sendResult);
            }
            
            @Override
            public void onException(Throwable e) {
                log.error("异步发送失败", e);
            }
        });
    }
}</code></pre>
            </div>
            
            <!-- 消费者实现 -->
            <div class="card bg-white rounded-lg p-6">
                <h3 class="text-xl font-medium mb-4 text-purple-700 flex items-center">
                    <i class="fas fa-inbox mr-2"></i> 消费者实现
                </h3>
                <pre><code class="language-java">@Service
@RocketMQMessageListener(
    topic = "test-topic",
    consumerGroup = "${rocketmq.consumer.group}",
    selectorExpression = "order-tag"  // 消费指定tag的消息
)
@Slf4j
public class OrderConsumer implements RocketMQListener&lt;OrderMessage&gt; {
    
    @Override
    public void onMessage(OrderMessage message) {
        log.info("收到订单消息: {}", message);
        // 处理订单业务逻辑
        processOrder(message);
    }
    
    private void processOrder(OrderMessage order) {
        // 模拟业务处理
        log.info("处理订单: {}, 金额: {}", order.getOrderId(), order.getAmount());
    }
}</code></pre>
            </div>
        </section>
    </main>
    
    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8 px-4">
        <div class="max-w-6xl mx-auto">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-400 hover:text-white transition">http://www.yuque.com/jtostring</a>
                </div>
                <div class="flex space-x-4">
                    <a href="#" class="text-gray-400 hover:text-white transition">
                        <i class="fab fa-github fa-lg"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition">
                        <i class="fab fa-twitter fa-lg"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>
    
    <script>
        // 初始化Mermaid图表
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>